﻿<BadHabit_Factory_Controls:GenericPanel
    x:Name="burnDownPanel"
    x:Class="BadHabit.Factory.Controls.BurnDownPanel"
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    xmlns:BadHabit_Factory_Controls="clr-namespace:BadHabit.Factory.Controls"             
    xmlns:BadHabit_WPFTools="clr-namespace:BadHabit.WPFTools;assembly=BadHabit.WPFTools"       
    
    xmlns:props="clr-namespace:BadHabit.Factory.Properties"
    
    HorizontalAlignment="Stretch"
    VerticalAlignment="Stretch"
    Background="Transparent"   
    Loaded="burnDownPanel_Loaded"
   >

    <BadHabit_Factory_Controls:GenericPanel.CommandBindings>
        <CommandBinding Command="ApplicationCommands.Save" CanExecute="Save_CanExecute" Executed="Save_Executed"/>
    </BadHabit_Factory_Controls:GenericPanel.CommandBindings>


    <Grid x:Name="ContentPanel" VerticalAlignment="Stretch">
        <Grid.RowDefinitions>
            <RowDefinition Height="Auto"/>
            <RowDefinition Height="*"/>
        </Grid.RowDefinitions>

        <DockPanel Grid.Row="0">
            <ToolBar x:Name="Toolbar" DockPanel.Dock="Left" ToolBarTray.IsLocked="True" Height="60" >



                <StackPanel Margin="5,0,5,0" HorizontalAlignment="Center" VerticalAlignment="Center">
                <TextBlock Text="{Binding ElementName=BurnDownGraph, Path=WalkingPct, StringFormat='{}{0:F0} %'}" Style="{StaticResource ToolBarBigTextBlock}" />
                <TextBlock Text="{x:Static props:Resources.walked}"  Style="{StaticResource ToolBarBigTextBlock}" FontSize="12" />
            </StackPanel>
            
            <StackPanel Margin="5,0,5,0" HorizontalAlignment="Center" VerticalAlignment="Center">
                <TextBlock Text="{Binding ElementName=BurnDownGraph, Path=LateHrs, StringFormat='{}{0:F0} hrs'}" Style="{StaticResource ToolBarBigTextBlock}" />
                <TextBlock Text="{x:Static props:Resources.late}" FontSize="12">
                    <TextBlock.Style>
                        <Style TargetType="TextBlock" BasedOn="{StaticResource ToolBarBigTextBlock}">
                            <Style.Triggers>
                                <DataTrigger Binding="{Binding ElementName=BurnDownGraph, Path=IsLate}" Value="True">
                                    <Setter Property="TextBlock.Visibility" Value="Visible"/>
                                </DataTrigger>
                                <DataTrigger Binding="{Binding ElementName=BurnDownGraph, Path=IsLate}" Value="False">
                                    <Setter Property="TextBlock.Visibility" Value="Collapsed"/>
                                </DataTrigger>
                            </Style.Triggers>
                        </Style>
                    </TextBlock.Style>
                </TextBlock>
                <TextBlock Text="{x:Static props:Resources.ahead}" FontSize="12">
                    <TextBlock.Style>
                        <Style TargetType="TextBlock" BasedOn="{StaticResource ToolBarBigTextBlock}">
                            <Style.Triggers>
                                <DataTrigger Binding="{Binding ElementName=BurnDownGraph, Path=IsLate}" Value="False">
                                    <Setter Property="TextBlock.Visibility" Value="Visible"/>
                                </DataTrigger>
                                <DataTrigger Binding="{Binding ElementName=BurnDownGraph, Path=IsLate}" Value="True">
                                    <Setter Property="TextBlock.Visibility" Value="Collapsed"/>
                                </DataTrigger>
                            </Style.Triggers>
                        </Style>
                    </TextBlock.Style>
                </TextBlock>
            </StackPanel>
            
            <Separator/>
            
            <Menu>
                <MenuItem                       
                    Header="{x:Static props:Resources.Whole_Project}"                                        
                    Click="wholeProjectButton_Click"                    
                    Style="{StaticResource ToolBarMenuItem}">
                    <MenuItem.Icon>
                        <Image Source="/Images/ToolBar/ProjectBurnDown.png" Stretch="Uniform" Width="32" Height="32"/>
                    </MenuItem.Icon>
                </MenuItem>
            </Menu>
           
            
        </ToolBar>
            <Button
                        x:Name="commitButton"
                        DockPanel.Dock="Right"
                        Style="{StaticResource CommitButton}"
                        Command="ApplicationCommands.Save"
                        HorizontalAlignment="Right" 
                        Margin="5" />
        </DockPanel>


        <BadHabit_Factory_Controls:BurnDownGraph x:Name="BurnDownGraph"
                                                 Grid.Row="1"                                                       
                                                 Margin="60,60,60,60"         
                                                 AllowNavigation="True"
                                                 HorizontalAlignment="Stretch"
                                                 VerticalAlignment="Stretch"/>

    </Grid>

</BadHabit_Factory_Controls:GenericPanel>
